package com.frp.protocol;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 登录响应消息
 */
public class LoginRespMessage extends Message {
    @JsonProperty("version")
    private String version;
    
    @JsonProperty("error")
    private String error;
    
    @JsonProperty("run_id")
    private String runId;
    
    @JsonProperty("server_udp_port")
    private int serverUdpPort;
    
    public LoginRespMessage() {
        super(MessageType.LoginResp);
    }
    
    public LoginRespMessage(String version, String error, String runId) {
        super(MessageType.LoginResp);
        this.version = version;
        this.error = error;
        this.runId = runId;
    }
    
    // Getters and Setters
    public String getVersion() { return version; }
    public void setVersion(String version) { this.version = version; }
    
    public String getError() { return error; }
    public void setError(String error) { this.error = error; }
    
    public String getRunId() { return runId; }
    public void setRunId(String runId) { this.runId = runId; }
    
    public int getServerUdpPort() { return serverUdpPort; }
    public void setServerUdpPort(int serverUdpPort) { this.serverUdpPort = serverUdpPort; }
    
    public boolean isSuccess() {
        return error == null || error.isEmpty();
    }
}